home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / wasm223.zip / MULPLX1.ASM < prev    next >
Assembly Source File  |  1993-05-04  |  3KB  |  71 lines

  1. ;*****************************************;
  2. ; WASM Multiplex Support, Resident Kernel ;
  3. ; By Eric Tauck                           ;
  4. ;                                         ;
  5. ; Defines:                                ;
  6. ;                                         ;
  7. ;   Old2F   old interrupt 2F              ;
  8. ;                                         ;
  9. ; Requires:                               ;
  10. ;                                         ;
  11. ;   MULPLX2.ASM                           ;
  12. ;                                         ;
  13. ; This code is the resident portion of    ;
  14. ; the multiplex support.  The routines in ;
  15. ; MULPLX2.ASM initialize this code and    ;
  16. ; data. This file should included within  ;
  17. ; the resident portion of the TSR, while  ;
  18. ; MULPLX2.ASM should be included in the   ;
  19. ; transient portion.                      ;
  20. ;                                         ;
  21. ; Note: This code must be branched around ;
  22. ; (with a JMP or JMPS).                   ;
  23. ;*****************************************;
  24.  
  25. ; RES_OFF and RES_ID must be EQUated by the user.  RES_ID is a 16 bit value
  26. ; that should be unique for all programs using MULPLX1.ASM and MULPLX2.ASM.
  27. ; RES_OFF is the byte offset to subtract from all memory references if the
  28. ; TSR is shifted to a lower memory location.  If the TSR is not shifted,
  29. ; RES_OFF should be set to zero.
  30.  
  31. ;================================================
  32. ; Multiplex interrupt handler.
  33.  
  34. ;--- check multiplex number
  35.  
  36. _PlxNew seg     cs
  37.         cmp     ax, _PlxNum - RES_OFF   ;check if query this TSR
  38.         je      _PlxNe1                 ;jump if so
  39.         seg     cs
  40.         call    _PlxHan - RES_OFF       ;call custom handler
  41.         jc      _PlxNe2                 ;jump if exit
  42.         seg     cs
  43.         jmp     PlxOld - RES_OFF        ;chain to old interrupt
  44.  
  45. ;--- number matches query, return resident info
  46.  
  47. _PlxNe1 sub     ax, ax                  ;acknowledge
  48.         mov     bx, RES_ID              ;return ID
  49.         seg     cs
  50.         mov     cx, _PlxVer - RES_OFF   ;return resident version
  51.         mov     dx, cs                  ;return segment
  52. _PlxNe2 iret
  53.  
  54. ;================================================
  55. ; Dummy hander. Only chains to previous handler.
  56.  
  57. _PlxDef PROC    NEAR
  58.         clc
  59.         ret
  60.         ENDP
  61.  
  62. ;================================================
  63. ; Multiplex data.
  64.  
  65. PlxOld  LABEL   DWORD                   ;original interrupt address
  66.         DS      4
  67.  
  68. _PlxNum DW      ?                       ;multiplex query number
  69. _PlxVer DW      ?                       ;resident version number
  70. _PlxHan DW      OFFSET _PlxDef-RES_OFF  ;user handler
  71.